package Si.Assign1.Main;

import Si.Assign1.Model.Addresses;
import Si.Assign1.Model.Categories;
import Si.Assign1.Model.Comments;
import Si.Assign1.Model.CreditCards;
import Si.Assign1.Model.CustomerOrders;
import Si.Assign1.Model.CustomerOrderDetails;
import Si.Assign1.Model.Customer;
import Si.Assign1.Model.Products;
import Si.Assign1.Model.ProductTypeAttributes;
import Si.Assign1.Model.ProductTypeAttributeValues;
import Si.Assign1.Model.ProductTypes;
import java.util.Calendar;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;




public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		 // TODO Auto-generated method stub
	     // Create the Entity Manager Factory.
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("Assign1");
		EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();	
	
        
        // Create Product1 
        Products products = new Products();
        products.setName("product1");
        products.setProductType(2);
        products.setPurchase_price(120.00);
        products.setSalePrice(150.00);
        products.setsku("good");
        
        // Create Product2
        products = new Products();
        products.setName("product2");
        products.setProductType(4);
        products.setPurchase_price(210.00);
        products.setSalePrice(550.00);
        products.setsku("great");
	
        Query q = em.createNamedQuery("getPByName");
        q.setParameter("name", "sku");
        Products getProduct = (Products)q.getSingleResult();
	
        em.getTransaction().commit();
        em.close();
        emf.close();
	
	}

}